//
//  IDCViewController.m
//  rock, paper, scissors
//
//  Created by iD Student on 7/23/13.
//  Copyright (c) 2013 student. All rights reserved.
//

#import "IDCViewController.h"

@interface IDCViewController ()

@end

@implementation IDCViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    welcomeMessage = [[NSString alloc] initWithString:@"Welcome to the game"];
    welcomeLabel.text = welcomeMessage;
    playerScoreText = [[NSMutableString alloc] initWithString:@"Draws: 0"];
    drawsLabel.text = playerScoreText;
    playerScore = 0;
    playerScoreText = [[NSMutableString alloc] initWithString:@"Wins: 0"];
    winsLabel.text = playerScoreText;
    playerScore = 0;
    playerScoreText = [[NSMutableString alloc] initWithString:@"Loses: 0"];
    losesLabel.text = playerScoreText;
    playerScore = 0;
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)chooserock:(id)sender {
    
    player1ImageView.image = [UIImage imageNamed:@"aaa.gif"];
    int randomNumber = arc4random()%3;
    
    if(randomNumber == 0){
         player2ImageView.image = [UIImage imageNamed:@"aaa.gif"];
        draw++;
        drawsLabel.text = [[NSString alloc] initWithFormat:@"draws: %d", draw];
    }
    else if(randomNumber == 1){
        player2ImageView.image = [UIImage imageNamed:@"tth.jpg"];
        win++;
        winsLabel.text = [[NSString alloc] initWithFormat:@"wins: %d", win];
        
    }
    else if(randomNumber == 2){
         player2ImageView.image = [UIImage imageNamed:@"paper-with-writing-clip-art.jpg"];
        lose++;
        losesLabel.text = [[NSString alloc] initWithFormat:@"loses: %d", lose];        
        
    }
    
}

- (IBAction)choosescissors:(id)sender {
    
    player1ImageView.image = [UIImage imageNamed:@"tth.jpg"];
    int randomNumber = arc4random()%3;
    
    if(randomNumber == 0){
        player2ImageView.image = [UIImage imageNamed:@"aaa.gif"];
        lose++;
        losesLabel.text = [[NSString alloc] initWithFormat:@"loses: %d", lose];
    }
    else if(randomNumber == 1){
        player2ImageView.image = [UIImage imageNamed:@"tth.jpg"];
        draw++;
        drawsLabel.text = [[NSString alloc] initWithFormat:@"draws: %d", draw];
    }
    else if(randomNumber == 2){
        player2ImageView.image = [UIImage imageNamed:@"paper-with-writing-clip-art.jpg"];
        win++;
        winsLabel.text = [[NSString alloc] initWithFormat:@"wins: %d", win];
    }
}

- (IBAction)choosepaper:(id)sender {
    
    player1ImageView.image = [UIImage imageNamed:@"paper-with-writing-clip-art.jpg"];
    int randomNumber = arc4random()%3;
    
    if(randomNumber == 0){
        player2ImageView.image = [UIImage imageNamed:@"aaa.gif"];
        win++;
        winsLabel.text = [[NSString alloc] initWithFormat:@"wins: %d", win];
    }
    else if(randomNumber == 1){
        player2ImageView.image = [UIImage imageNamed:@"tth.jpg"];
        lose++;
        losesLabel.text = [[NSString alloc] initWithFormat:@"loses: %d", lose];
    }
    else if(randomNumber == 2){
        player2ImageView.image = [UIImage imageNamed:@"paper-with-writing-clip-art.jpg"];
        draw++;
        drawsLabel.text = [[NSString alloc] initWithFormat:@"draws: %d", draw];

    }
}
@end











